<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

/** @var \yii\web\View $this */
/** @var \builder\lists\ListBuilder $context 当前列表组件实例 */
/** @var array $rootLayout 根布局 */
/** @var array $listLayout 根布局 */
/** @var array $listRows 列表行数据 */

$context = $this->context;
?>

<div class="layui-card mb-0 shadow-none <?= $rootLayout['class'] ?>"
     style="<?= $rootLayout['style'] ?>"
     ng-controller="ym2.ctrl.<?= $context->id ?>"
     <?= $rootLayout['attribute'] ?>>

    <div class="layui-card-body px-4 pb-0">
        <table class="layui-table ym2-table-gray <?= $listLayout['class'] ?>"
               style="<?= $listLayout['style'] ?>"
               <?= $listLayout['attribute'] ?>>

            <tbody>
            <?php foreach ($listRows as $label => $options): ?>
            <?php if (is_int($label) && is_array($options)): ?>

            <tr>
                <?php foreach ($options as $linkLabel => $linkOptions): ?>

                <th class="<?= $linkOptions['thClass'] ?>"
                    style="<?= $linkOptions['thStyle'] ?>"
                    <?= $linkOptions['thAttribute'] ?>>

                    <?= $linkLabel ?>

                </th>
                <td class="<?= $linkOptions['tdClass'] ?>"
                    style="<?= $linkOptions['tdStyle'] ?>"
                    <?= $linkOptions['tdAttribute'] ?>>

                    <?= $linkOptions['content'] ?>

                </td>
                <?php endforeach; ?>

            </tr>
            <?php else: ?>

            <tr>
                <th class="<?= $options['thClass'] ?>"
                    style="<?= $options['thStyle'] ?>"
                    <?= $options['thAttribute'] ?>>

                    <?= $label ?>

                </th>
                <td class="<?= $options['tdClass'] ?>"
                    style="<?= $options['tdStyle'] ?>"
                    <?= $options['tdAttribute'] ?>>

                    <?= $options['content'] ?>

                </td>
            </tr>
            <?php endif; ?>
            <?php endforeach; ?>

            </tbody>

        </table>
    </div>
</div>
